home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / pyshared / ibus / enginedesc.py < prev    next >
Text File  |  2009-11-05  |  3KB  |  106 lines

  1. # vim:set et sts=4 sw=4:
  2. #
  3. # ibus - The Input Bus
  4. #
  5. # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
  6. #
  7. # This library is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU Lesser General Public
  9. # License as published by the Free Software Foundation; either
  10. # version 2 of the License, or (at your option) any later version.
  11. #
  12. # This library is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU Lesser General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Lesser General Public
  18. # License along with this program; if not, write to the
  19. # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  20. # Boston, MA  02111-1307  USA
  21.  
  22. __all__ = (
  23.         "EngineDesc",
  24.     )
  25.  
  26. import dbus
  27. from exception import IBusException
  28. from serializable import *
  29.  
  30. class EngineDesc(Serializable):
  31.     __gtype_name__ = "PYIBusEngineDesc"
  32.     __NAME__ = "IBusEngineDesc"
  33.     def __init__ (self, name="", longname="", description="", language="", license="", author="", icon="", layout=""):
  34.         super(EngineDesc, self).__init__()
  35.         self.__name = name
  36.         self.__longname = longname
  37.         self.__description = description
  38.         self.__language = language
  39.         self.__license = license
  40.         self.__author = author
  41.         self.__icon = icon
  42.         self.__layout = layout
  43.  
  44.     def get_name(self):
  45.         return self.__name
  46.  
  47.     def get_longname(self):
  48.         return self.__longname
  49.  
  50.     def get_description(self):
  51.         return self.__description
  52.  
  53.     def get_language(self):
  54.         return self.__language
  55.  
  56.     def get_license(self):
  57.         return self.__license
  58.  
  59.     def get_author(self):
  60.         return self.__author
  61.  
  62.     def get_icon(self):
  63.         return self.__icon
  64.  
  65.     def get_layout(self):
  66.         return self.__layout
  67.  
  68.     name        = property(get_name)
  69.     longname    = property(get_longname)
  70.     description = property(get_description)
  71.     language    = property(get_language)
  72.     license     = property(get_license)
  73.     author      = property(get_author)
  74.     icon        = property(get_icon)
  75.     layout      = property(get_layout)
  76.  
  77.     def serialize(self, struct):
  78.         super(EngineDesc, self).serialize(struct)
  79.         struct.append (dbus.String(self.__name))
  80.         struct.append (dbus.String(self.__longname))
  81.         struct.append (dbus.String(self.__description))
  82.         struct.append (dbus.String(self.__language))
  83.         struct.append (dbus.String(self.__license))
  84.         struct.append (dbus.String(self.__author))
  85.         struct.append (dbus.String(self.__icon))
  86.         struct.append (dbus.String(self.__layout))
  87.  
  88.     def deserialize(self, struct):
  89.         super(EngineDesc, self).deserialize(struct)
  90.         self.__name = struct.pop(0)
  91.         self.__longname = struct.pop(0)
  92.         self.__description = struct.pop(0)
  93.         self.__language = struct.pop(0)
  94.         self.__license = struct.pop(0)
  95.         self.__author = struct.pop(0)
  96.         self.__icon = struct.pop(0)
  97.         self.__layout = struct.pop(0)
  98.  
  99. def test():
  100.     engine = EngineDesc("Hello", "", "", "", "", "", "", "")
  101.     value = serialize_object(engine)
  102.     engine = deserialize_object(value)
  103.  
  104. if __name__ == "__main__":
  105.     test()
  106.